package com.fancyy.scm.util;

/**
 * Created by curry on 2017/9/5.
 */

public class Util {

    private static long lastClickTime = 0;  //上次点击的时间
    private static int spaceTime = 1500;    //时间间隔

    /**
     * 防止多次点击  在按钮的点击事件中调用
     *
     * @return
     */
    public static boolean isFastClick() {
        //当前系统时间
        long currentTime = System.currentTimeMillis();
        //是否允许点击
        boolean isAllowClick;
        if (currentTime - lastClickTime > spaceTime) {
            isAllowClick = false;
        } else {
            isAllowClick = true;
        }
        lastClickTime = currentTime;
        return isAllowClick;
    }
}
